{layout name="layout" /}

<link href="/static/highlight/styles/monokai-sublime.css" rel="stylesheet"> 

<div class="box">
  <div class="blank"></div>
  <div class="infosbox">
    <div class="newsview">
      <h3 class="news_title">{$data.title}</h3>
      <div class="bloginfo">
        <ul>
          <li class="author"><a href="{:url('/lists/'.$cid.'/1')}"> {$cid|model('admin/blog_category')->getCateName} </a></li>
          <li class=" timer">{$data.pubtime|date="Y-m-d", ###}</li>
          <li class="view">{$data.clicks} 已阅读</li>
          <!-- <li class="like">8888888</li> -->
        </ul>
      </div>
      <!-- <div class="tags"><a href="/" target="_blank">个人博客</a> &nbsp; <a href="/" target="_blank">小世界</a></div> -->
      <div class="news_about"><strong>简介</strong>{$data.summary}</div>
      <div class="news_con" id="preview">

      </div>
      <p id="content_md" style="display: none;">{$data.content_md}</p>
      <p class="diggit"><a href="JavaScript:getLike({$data.id});"> 很赞哦！ </a>(<b id="diggnum"> {$data.like} </b>)</p>
    </div>
    <div class="nextinfo">
      {empty name="prev_next.prev"}
      <p>上一篇：<a href="#">没有了</a></p>
      {else}
      <p>上一篇：<a href="/{$prev_next.prev.pubtime|date='Y/m/d', ###}/{$prev_next['prev']['id']}" title="{$prev_next.prev.title}">{$prev_next.prev.title}</a></p>
      {/empty}
      {empty name="prev_next.next"}
      <p>下一篇：<a href="{:url('/time')}">返回列表</a></p>
      {else}
      <p>下一篇：<a
          href="/{$prev_next.next.pubtime|date='Y/m/d', ###}/{$prev_next['next']['id']}"
          title="{$prev_next.next.title}">{$prev_next.next.title}</a></p>
      {/empty}
    </div>
    <!-- <div class="otherlink">
      <h2>相关文章</h2>
      <ul>
        <li><a href="#" title="##">###</a></li>
      </ul>
    </div> -->
    <div class="news_pl">
      <h2>文章评论</h2>
      <ul>
        <div class="gbko"> </div>
      </ul>
    </div>
  </div>
  {include file="aside"}
</div>

<script src="/static/highlight/highlight.pack.js"></script>
<script src="/static/md/js/marked.js"></script>
<script type="text/javascript">
  hljs.initHighlightingOnLoad();

  marked.setOptions({
    renderer: new marked.Renderer(),
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: false,
    smartLists: true,
    smartypants: false,
    highlight: function (code) {
      return hljs.highlightAuto(code).value;
    }
  });

  $("#preview").html(marked($("#content_md").html()));
  function getLike(id) {
    var num = parseInt($('#diggnum').text());
    $.post('/getlike', {
      'id': id
    }, function (data) {
      if (data.code=2) {
        $('#diggnum').text(num+1);
      }
    }, 'json');
  }
</script>